<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>栈结构</title>
	</head>
	<body>
		<script src="index.js"></script>
		<script>
			// 击鼓传花
			function lastName(arrName, num) {
				let res = arrName[0]
				let queue = new Queue()
				for (let j = 0; j < arrName.length; j++) {
					queue.enquene(arrName[j])
				}
				let i = 0
				while (queue.size() > 1) {
					i++
					if (i === num) {
						queue.dequene()
						i = 0
					} else {
						queue.enquene(queue.dequene())
					}
				}
				return queue
			}
			let arr = ['lily', 'lucy', 'Tom', 'lilei', 'why']
			console.log(lastName(arr, 3))
		</script>
	</body>
</html>
